<%@page import="databaseDAO.Menu2Dao,java.util.*,bean.*"%>
<%@ page language="java" pageEncoding="UTF-8"%>
<%
  String path = request.getContextPath();
  String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
  %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>左侧导航</title>
<head>
<link rel="stylesheet" href="css/style.css">
<script type="text/javascript" src="js/jquery.js"></script>
<script type="text/javascript">
	$(".leftsidebar_box dt").css({"background-color":"#3992d0"});
	$(".leftsidebar_box dt img").attr("src","images/left/select_xl01.png");
	$(function(){
		$(".leftsidebar_box dd").hide();
		$(".leftsidebar_box dt").click(function(){
			$(".leftsidebar_box dt").css({"background-color":"#3992d0"})
			$(this).css({"background-color": "#317eb4"});
			$(this).parent().find('dd').removeClass("menu_chioce");
			$(".leftsidebar_box dt img").attr("src","images/left/select_xl01.png");
			$(this).parent().find('img').attr("src","images/left/select_xl.png");
			$(".menu_chioce").slideUp(); 
			$(this).parent().find('dd').slideToggle();
			$(this).parent().find('dd').addClass("menu_chioce");
		});
	})
</script>
<script type="text/javascript">


</script>
</head>

<body id="bg" link="#9933ff" alink="#0066ff" vlink="#ff0000">
<% 
   MenuBean mbUser = (MenuBean)session.getAttribute("mbUser");
   
    //方案2
    List<String> lsMenuID =(List<String>)session.getAttribute("lsMenuID");
    
	UserBean ub = (UserBean)session.getAttribute("user");
    
   // System.out.println("对还是错+"+lsMenuID.contains("6"));
	Menu2Dao m2d = new Menu2Dao();
	List<MenuBean> listBean = null;
	
	listBean = m2d.queryMenuByRoleID(ub.getRoleID());
		
	
    Iterator<MenuBean> it = listBean.iterator();
    MenuBean mb = null;
    int i = 0;
    int index = 0;
    String[] pic = {"system_log","custom","channel","app","cloud","syetem_management","source","statistics"};
    %>
<div >
<!-- system_log custom channel app cloud syetem_management source statistics -->
	<div class="header_box" >
		<p>
		用户：<%=ub.getUserName() %> &nbsp;您已在线时长：<%=ub.getLoginTimeLong() %>&nbsp;<input type="button" id="add" value="退出"  onclick='location="<%=basePath%>LoginServlet?a=loginOut";' value='跳转到LoginServlet'/>
		</p>
	</div>
	<div class="leftsidebar_box">
	<center><dt>权限管理系统</dt></center>
		<div class="line"></div>
		<%-- <div class="modifyUser"><center><a href="/RightManagementSystem/LoginServlet?a=modifyUser&uid=<%=ub.getUserID()%>" target="fname">更新个人情况</a></center></div> --%>
		<dl class="custom">
		   <dt><a href="/RightManagementSystem/LoginServlet?a=modifyUser&uid=<%=ub.getUserID()%>" target="fname">更新个人情况</a></dt>
		</dl>
		<%if(lsMenuID.contains("1")){ %>
		
		<%
		while(it.hasNext()){
	    	mb = it.next();	
	    	index = (int)(Math.random()*pic.length);
	    	//if(mbUser.getMenuID().charAt(0)!=mb.getMenuID().charAt(0)||!mbUser.getMenuID().equals("1"))
	    	//	continue;
	    	%>
		
		<%if(mb.getMenuID().equals(mb.getForeID())){
			
			if(mb.getMenuID().equals(mb.getForeID())){%>
			</dl>
			<%} %>
			<dl class="<%=pic[index]%>">
			<dt onClick="changeImage()"><%=mb.getFunctionName() %><img src="images/left/select_xl01.png"></dt>
			<%} else if((mb.getMenuID().length()>1)){%>
			<dd class="first_dd" >
			<!--   -->
			<a href="<%=mb.getUrl() %>" target="fname"><%=mb.getFunctionName()%></a>			 
			</dd>
			<%}%>
		<%} %>
		
		</dl>
		
		
		
		<!-- 非管理员 -->
		<%}else{ %>
		
		<%
		System.out.println();
		while(it.hasNext()){
	    	mb = it.next();	
	    	index = (int)(Math.random()*pic.length);
	    	
	    	
	    	
	   
	    	%>
		
		<%if(mb.getMenuID().equals(mb.getForeID())){
			
			if(mb.getMenuID().equals(mb.getForeID())){%>
			</dl>
			<%} %>
			<dl class="<%=pic[index]%>">
			<dt onClick="changeImage()"><%=mb.getFunctionName() %><img src="images/left/select_xl01.png"></dt>
			<%} else if((((mb.getMenuID().length()>1)))){       // &&mbUser.getMenuID().length()==1)||mb.getMenuID().equals(mbUser.getMenuID())%>
			<dd class="first_dd" >
			<!--   -->
			<a href="<%=mb.getUrl() %>" target="fname"><%=mb.getFunctionName()%></a>			 
			</dd>
			<%}%>
		<%} %>
		
		</dl>
		
		
		
		<%} %>
		<!-- 
		<dl class="system_log">
			<dt onClick="changeImage()">用户管理<img src="images/left/select_xl01.png"></dt>
			
			<dd class="first_dd" >
			<a href="../admin/AddUser.jsp" target="fname">新增用户</a>			 
			</dd>
			<dd><a href="text2.html" target="fname">修改删除用户</a></dd>
			
			 <dd><a href="#">查询用户登录情况</a></dd> 
			 <dd><a href="#">更新个人情况</a></dd>  
		</dl>
	
		<dl class="custom">			
			<dt onClick="changeImage()">角色管理<img src="images/left/select_xl01.png"></dt>
			<dd class="first_dd"><a href="#">新增角色</a></dd>
			<dd><a href="#">修改角色</a></dd>
			<dd><a href="#">删除角色</a></dd>
			<dd><a href="#">即将到期客户管理</a></dd>
		</dl>
	
		<dl class="channel">
			<dt>人事管理<img src="images/left/select_xl01.png"></dt>
			<dd class="first_dd"><a href="#"><font color="grey">查询人事记录</font></a></dd>
			<dd><a href="#"><font color="grey">统计人事记录</font></a></dd>
			<dd><a href="#"><font color="grey">修改人事记录</font></a></dd>
			
		</dl>
	
		<dl class="cloud">"app"
			<dt onClick="changeImage()">财务管理<img src="images/left/select_xl01.png"></dt>
			<dd class="first_dd"><a href="#"><font color="grey">查询财务记录</font></a></dd>
			<dd><a href="javascript:volid(0);"><font color="grey">统计销售记录</font></a></dd>
			<dd><a href="javascript:volid(0);"><font color="grey">修改销售记录</font></a></dd>
			<dd><a href="javascript:return false;" color:"#red";>不可点击1</a></dd>
			<dd><a href="javascript:volid(0);"><font color="grey">不可点击2</font></a></dd>
		</dl>
	
		
	 
		<dl class="syetem_management">
			<dt>技术管理<img src="images/left/select_xl01.png"></dt>
			<dd class="first_dd"><a href="#"><font color="grey">查询技术记录</font></a></dd>
			<dd><a href="#"><font color="grey">统计技术记录</font></a></dd>
			<dd><a href="#"><font color="grey">修改技术记录</font></a></dd>
			
		</dl> -->
	<!--
		<dl class="source">
			<dt>素材库管理<img src="images/left/select_xl01.png"></dt>
			<dd class="first_dd"><a href="#">图片库</a></dd>
			<dd><a href="#">链接库</a></dd>
			<dd><a href="#">推广管理</a></dd>
		</dl>
	
		<dl class="statistics">
			<dt>统计分析<img src="images/left/select_xl01.png"></dt>
			<dd class="first_dd"><a href="#">客户统计</a></dd>
		</dl> -->
	
	</div>
   
</div>
<div class="fdiv">
 <iframe name="fname" src="text2.html" class="fname"></iframe>
</div>

</body>
</html>
